package com.kevin.tools.data.mapper;


public class DescMapper implements Mapper{

	public  int priority;
	
	public DescMapper(int priority) {
		super();
		this.priority = priority;
	}

	@Override
	public boolean map(Data left, Data right) {
		String leftDesc = left.getDesc();
		String rightDesc = right.getDesc();
		if(StringUtils.isNotBlank(leftDesc)&&StringUtils.isNotBlank(rightDesc)){
			leftDesc = leftDesc.toLowerCase().trim();
			rightDesc=rightDesc.toLowerCase().trim();
			if(leftDesc.equals(rightDesc)){
				return true;
			}
		}
		return false;
	}
	
	public int getPriority() {
		return priority;
	}

	public void setPriority(int priority) {
		this.priority = priority;
	}

	@Override
	public int compareTo(Mapper o) {
		if(priority>o.getPriority())
			return 1;
		else if(priority==o.getPriority())
			return 0;
		else
		    return -1;
	}

}
